package com.topcheer.common.base.util;

import com.google.common.collect.Maps;
import com.sun.org.apache.xpath.internal.operations.Bool;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author xutao
 * @Package com.topcheer.common.base.util
 * @Description: ${todo}
 * @date 2020/3/31 15:53
 */
public class CommonCache {

    private static Map<String,Object> map = new ConcurrentHashMap<>(1024);

    private static Map<String,String> handlerAndPredicate = new ConcurrentHashMap<>(1024);

    public static Object get(String key) {
        return map.get(key);
    }

    public static void put(String key,Object value) {
        map.put(key,value);
    }

    public static String getPredicate(String handler){
        return handlerAndPredicate.get(handler);
    }

    public static void putPredicate(String handler,String predicate){
        handlerAndPredicate.put(handler, predicate);
    }

    public static Boolean isNullHandler(){
        return handlerAndPredicate.size() == 0;
    }
}
